home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / hf^k-2.dms / in.adf / MUIClass.Lha / Include / Classes / TWiMUI / List.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-02  |  9.6 KB  |  231 lines

  1. //
  2. //  $VER: List.h        1.2 (02 Sep 1996)
  3. //
  4. //    c 1996 Thomas Wilhelmi
  5. //
  6. //
  7. // Address : Taunusstrasse 14
  8. //           61138 Niederdorfelden
  9. //           Germany
  10. //
  11. //  E-Mail : willi@twi.rhein-main.de
  12. //
  13. //   Phone : +49 (0)6101 531060
  14. //   Fax   : +49 (0)6101 531061
  15. //
  16. //
  17. //  $HISTORY:
  18. //
  19. //  16 Jun 1996 :   1.0 : first public Release
  20. //
  21. //  27 Jul 1996 :   1.1 : Bug Fixes:
  22. //                        - List.h
  23. //                          Bei der Methode Visible() hatte ich einen Schreibfehler.
  24. //                          Vielen Dank an Thorsten Rinn für den Bug-Report.
  25. //                        Neu:
  26. //                        - Für die vordefinierten speziellen Werte MUIV_List_Insert_Top,
  27. //                          MUIV_List_Insert_Active, MUIV_List_Insert_Sorted und
  28. //                          MUIV_List_Inserted_Bottom sind eigene Methoden definiert
  29. //                          worden.
  30. //
  31. //  02 Sep 1996 :   1.2 : Neu:
  32. //                        - operator=() und der Copy-Kunstroktor übernehmen auch alle Entries
  33. //                        - ClassNum() für Exception-Handling.
  34. //                        Änderungen:
  35. //                        - NextSelected() gibt den Wert der der Variablen auch als
  36. //                          Return-Wert zurück.
  37. //                        - Parameter des Copy-Konstruktor als 'const'-Parameter definiert
  38. //
  39.  
  40. #ifndef CPP_TWIMUI_LIST_H
  41. #define CPP_TWIMUI_LIST_H
  42.  
  43. #ifndef CPP_TWIMUI_AREA_H
  44. #include <classes/twimui/area.h>
  45. #endif
  46.  
  47. #ifndef UTILITY_HOOKS_H
  48. #include <utility/hooks.h>
  49. #endif
  50.  
  51. class MUIListCompareHook
  52.     {
  53.     private:
  54.         struct Hook comparehook;
  55.         static LONG CompareHookEntry(register __a0 struct Hook *, register __a2 APTR, register __a1 APTR);
  56.         virtual LONG CompareHookFunc(struct Hook *, APTR, APTR);
  57.     protected:
  58.         MUIListCompareHook();
  59.         MUIListCompareHook(const MUIListCompareHook &p);
  60.         ~MUIListCompareHook();
  61.         MUIListCompareHook &operator= (const MUIListCompareHook &);
  62.     public:
  63.         struct Hook *compare() { return(&comparehook); };
  64.     };
  65.  
  66. class MUIListConstructHook
  67.     {
  68.     private:
  69.         struct Hook constructhook;
  70.         static APTR ConstructHookEntry(register __a0 struct Hook *, register __a2 APTR, register __a1 APTR);
  71.         virtual APTR ConstructHookFunc(struct Hook *, APTR, APTR);
  72.     protected:
  73.         MUIListConstructHook();
  74.         MUIListConstructHook(const MUIListConstructHook &p);
  75.         ~MUIListConstructHook();
  76.         MUIListConstructHook &operator= (const MUIListConstructHook &);
  77.     public:
  78.         struct Hook *construct() { return(&constructhook); };
  79.     };
  80.  
  81. class MUIListDestructHook
  82.     {
  83.     private:
  84.         struct Hook destructhook;
  85.         static void DestructHookEntry(register __a0 struct Hook *, register __a2 APTR, register __a1 APTR);
  86.         virtual void DestructHookFunc(struct Hook *, APTR, APTR);
  87.     protected:
  88.         MUIListDestructHook();
  89.         MUIListDestructHook(const MUIListDestructHook &p);
  90.         ~MUIListDestructHook();
  91.         MUIListDestructHook &operator= (const MUIListDestructHook &);
  92.     public:
  93.         struct Hook *destruct() { return(&destructhook); };
  94.     };
  95.  
  96. class MUIListDisplayHook
  97.     {
  98.     private:
  99.         struct Hook displayhook;
  100.         static void DisplayHookEntry(register __a0 struct Hook *, register __a2 STRPTR *, register __a1 APTR);
  101.         virtual void DisplayHookFunc(struct Hook *, STRPTR *, APTR);
  102.     protected:
  103.         MUIListDisplayHook();
  104.         MUIListDisplayHook(const MUIListDisplayHook &p);
  105.         ~MUIListDisplayHook();
  106.         MUIListDisplayHook &operator= (const MUIListDisplayHook &);
  107.     public:
  108.         struct Hook *display() { return(&displayhook); };
  109.     };
  110.  
  111. class MUIListMultiTestHook
  112.     {
  113.     private:
  114.         struct Hook multitesthook;
  115.         static BOOL MultiTestHookEntry(register __a0 struct Hook *, register __a1 APTR);
  116.         virtual BOOL MultiTestHookFunc(struct Hook *, APTR);
  117.     protected:
  118.         MUIListMultiTestHook();
  119.         MUIListMultiTestHook(const MUIListMultiTestHook &p);
  120.         ~MUIListMultiTestHook();
  121.         MUIListMultiTestHook &operator= (const MUIListMultiTestHook &);
  122.     public:
  123.         struct Hook *multitest() { return(&multitesthook); };
  124.     };
  125.  
  126. class MUIList
  127.     :   public MUIArea,
  128.         public MUIListCompareHook,
  129.         public MUIListConstructHook,
  130.         public MUIListDestructHook,
  131.         public MUIListDisplayHook,
  132.         public MUIListMultiTestHook
  133.     {
  134.     protected:
  135.         virtual const ULONG ClassNum() const;
  136.         MUIList(const STRPTR cl)
  137.             :   MUIArea(cl),
  138.                 MUIListCompareHook(),
  139.                 MUIListConstructHook(),
  140.                 MUIListDestructHook(),
  141.                 MUIListDisplayHook(),
  142.                 MUIListMultiTestHook()
  143.             { };
  144.     public:
  145.         MUIList(const struct TagItem *t)
  146.             :   MUIArea(MUIC_List),
  147.                 MUIListCompareHook(),
  148.                 MUIListConstructHook(),
  149.                 MUIListDestructHook(),
  150.                 MUIListDisplayHook(),
  151.                 MUIListMultiTestHook()
  152.             {
  153.             init(t);
  154.             };
  155.         MUIList(const Tag, ...);
  156.         MUIList()
  157.             :   MUIArea(MUIC_List),
  158.                 MUIListCompareHook(),
  159.                 MUIListConstructHook(),
  160.                 MUIListDestructHook(),
  161.                 MUIListDisplayHook(),
  162.                 MUIListMultiTestHook()
  163.             { };
  164.         MUIList(const MUIList &p);
  165.         virtual ~MUIList();
  166.         MUIList &operator= (const MUIList &);
  167.         void Active(const LONG p) { set(MUIA_List_Active,(ULONG)p); };
  168.         void ActiveOff() { set(MUIA_List_Active,MUIV_List_Active_Off); };
  169.         void ActiveTop() { set(MUIA_List_Active,MUIV_List_Active_Top); };
  170.         void ActiveBottom() { set(MUIA_List_Active,MUIV_List_Active_Bottom); };
  171.         void ActiveUp() { set(MUIA_List_Active,MUIV_List_Active_Up); };
  172.         void ActiveDown() { set(MUIA_List_Active,MUIV_List_Active_Down); };
  173.         void ActivePageUp() { set(MUIA_List_Active,MUIV_List_Active_PageUp); };
  174.         void ActivePageDown() { set(MUIA_List_Active,MUIV_List_Active_PageDown); };
  175.         LONG Active() const { return((LONG)get(MUIA_List_Active,MUIV_List_Active_Off)); };
  176.         void AutoVisible(const BOOL p) { set(MUIA_List_AutoVisible,(ULONG)p); };
  177.         BOOL AutoVisible() const { return((BOOL)get(MUIA_List_AutoVisible,FALSE)); };
  178.         void CompareHook(const struct Hook *p) { set(MUIA_List_CompareHook,(ULONG)p); };
  179.         void ConstructHook(const struct Hook *p) { set(MUIA_List_ConstructHook,(ULONG)p); };
  180.         void ConstructHookString() { set(MUIA_List_ConstructHook,MUIV_List_ConstructHook_String); };
  181.         void DestructHook(const struct Hook *p) { set(MUIA_List_DestructHook,(ULONG)p); };
  182.         void DestructHookString() { set(MUIA_List_DestructHook,MUIV_List_DestructHook_String); };
  183.         void DisplayHook(const struct Hook *p) { set(MUIA_List_DisplayHook,(ULONG)p); };
  184.         void DragSortable(const BOOL p) { set(MUIA_List_DragSortable,(ULONG)p); };
  185.         BOOL DragSortable() const { return((BOOL)get(MUIA_List_DragSortable,FALSE)); };
  186.         LONG DropMark() const { return((LONG)get(MUIA_List_DropMark,0L)); };
  187.         LONG Entries() const { return((LONG)get(MUIA_List_Entries,0L)); };
  188.         LONG First() const { return((LONG)get(MUIA_List_First,0L)); };
  189.         void Format(const STRPTR p) { set(MUIA_List_Format,(ULONG)p); };
  190.         STRPTR Format() const { return((STRPTR)get(MUIA_List_Format,NULL)); };
  191.         LONG InsertPosition() const { return((LONG)get(MUIA_List_InsertPosition,0L)); };
  192.         void MultiTestHook(const struct Hook *p) { set(MUIA_List_MultiTestHook,(ULONG)p); };
  193.         void Quiet(const BOOL p) { set(MUIA_List_Quiet,(ULONG)p); };
  194.         void ShowDropMarks(const BOOL p) { set(MUIA_List_ShowDropMarks,(ULONG)p); };
  195.         BOOL ShowDropMarks() const { return((BOOL)get(MUIA_List_ShowDropMarks,FALSE)); };
  196.         void Title(const STRPTR p) { set(MUIA_List_Title,(ULONG)p); };
  197.         STRPTR Title() const { return((STRPTR)get(MUIA_List_Title,NULL)); };
  198.         LONG Visible() const { return((LONG)get(MUIA_List_Visible,0L)); };
  199.         void Clear() { dom(MUIM_List_Clear); };
  200.         APTR CreateImage(Object *p1, ULONG p2) { return((APTR)dom(MUIM_List_CreateImage,(ULONG)p1,(ULONG)p2)); };
  201.         void DeleteImage(APTR p) { dom(MUIM_List_DeleteImage,(ULONG)p); };
  202.         void Exchange(LONG p1, LONG p2) { dom(MUIM_List_Exchange,(ULONG)p1,(ULONG)p2); };
  203.         APTR GetEntry(LONG p) { APTR t; dom(MUIM_List_GetEntry,(ULONG)p,(ULONG)&t); return(t); };
  204.         APTR GetEntryActive() { APTR t; dom(MUIM_List_GetEntry,MUIV_List_GetEntry_Active,(ULONG)&t); return(t); };
  205.         void Insert(APTR *p1, LONG p2, LONG p3) { dom(MUIM_List_Insert,(ULONG)p1,(ULONG)p2,(ULONG)p3); };
  206.         void InsertTop(APTR *p1, LONG p2) { dom(MUIM_List_Insert,(ULONG)p1,(ULONG)p2,MUIV_List_Insert_Top); };
  207.         void InsertActive(APTR *p1, LONG p2) { dom(MUIM_List_Insert,(ULONG)p1,(ULONG)p2,MUIV_List_Insert_Active); };
  208.         void InsertSorted(APTR *p1, LONG p2) { dom(MUIM_List_Insert,(ULONG)p1,(ULONG)p2,MUIV_List_Insert_Sorted); };
  209.         void InsertBottom(APTR *p1, LONG p2) { dom(MUIM_List_Insert,(ULONG)p1,(ULONG)p2,MUIV_List_Insert_Bottom); };
  210.         void InsertSingle(APTR p1, LONG p2) { dom(MUIM_List_InsertSingle,(ULONG)p1,(ULONG)p2); };
  211.         void InsertSingleTop(APTR p) { dom(MUIM_List_InsertSingle,(ULONG)p,MUIV_List_Insert_Top); };
  212.         void InsertSingleActive(APTR p) { dom(MUIM_List_InsertSingle,(ULONG)p,MUIV_List_Insert_Active); };
  213.         void InsertSingleSorted(APTR p) { dom(MUIM_List_InsertSingle,(ULONG)p,MUIV_List_Insert_Sorted); };
  214.         void InsertSingleBottom(APTR p) { dom(MUIM_List_InsertSingle,(ULONG)p,MUIV_List_Insert_Bottom); };
  215.         void Jump(LONG p) { dom(MUIM_List_Jump,(ULONG)p); };
  216.         void Move(LONG p1, LONG p2) { dom(MUIM_List_Move,(ULONG)p1,(ULONG)p2); };
  217.         LONG NextSelected(LONG *p) { dom(MUIM_List_NextSelected,(ULONG)p); return(*p); };
  218.         void Redraw(LONG p) { dom(MUIM_List_Redraw,(ULONG)p); };
  219.         void RedrawActive() { dom(MUIM_List_Redraw,MUIV_List_Redraw_Active); };
  220.         void RedrawAll() { dom(MUIM_List_Redraw,MUIV_List_Redraw_All); };
  221.         void Remove(LONG p) { dom(MUIM_List_Remove,(ULONG)p); };
  222.         void RemoveFirst() { dom(MUIM_List_Remove,MUIV_List_Remove_First); };
  223.         void RemoveActive() { dom(MUIM_List_Remove,MUIV_List_Remove_Active); };
  224.         void RemoveLast() { dom(MUIM_List_Remove,MUIV_List_Remove_Last); };
  225.         void Select(LONG p1, LONG p2, LONG *p3) { dom(MUIM_List_Select,(ULONG)p1,(ULONG)p2,(ULONG)p3); };
  226.         void Sort() { dom(MUIM_List_Sort); };
  227.         void TestPos(LONG p1, LONG p2, struct MUI_List_TestPos_Result *p3) { dom(MUIM_List_TestPos,(ULONG)p1,(ULONG)p2,(ULONG)p3); };
  228.     };
  229.  
  230. #endif
  231.